package com.lagou.service;

import com.alibaba.fastjson.JSON;

/**
 * @author 123
 * @date 2020/5/15 11:12
 * @description
 */
public class JSONSerializer implements Serializer {

    public byte[] serialize(Object object) {
//        return JSON.toJSONBytes(object);
        return  JSON.toJSONString(object).getBytes();
    }

    public <T> T deserialize(Class<T> clazz, byte[] bytes) {
        return JSON.parseObject(bytes, clazz);
    }

}
